<!DOCTYPE html>
<html>
  <head>
    <title><%= title %></title>
    <link rel='stylesheet' href='/stylesheets/style.css' />
    <script type="text/javascript" src="/socket.io/socket.io.js"></script>
  </head>
  <body>
    <p><%= num %></p>
    <div id="content"></div>

    <input type="" name="" onchange="emitMsg()">

    <script type="text/javascript">
    	var socket = io.connect();
    	/*socket.on('msg', function(data){

    	})*/
    	function emitMsg(){
    		//console.log(event.target.value);
    		socket.emit('say', event.target.value)
    	}

    	var divdom = document.getElementById('content');
    	socket.on('newsay', data => {
    		var pdom = document.createElement('p');
    		pdom.innerHTML = data;
    		divdom.appendChild(pdom);
    	})
    </script>
  </body>
</html>
